Miedecke raced his way forward in the opening stint aboard the Ford Mustang GT4 before Gray claimed the lead and resisted late pressure to seal the victory.
Tom Hayman did his best to force a late error from Gary, raching the flag second in the McLaren Artura GT4 he shared with Marcos Flack.
An incident in pit entry midway through the race between Antonio Astuti and Lachlan Mineeff threatened to turn the encounter on its head.
Astuti drove into the rear of the Pro-Am Porsche as they approached the control line at pit entry, eliminating both and littering the lane with debris.
Despite the stricken car at pit entry, racing continued unimpacted, with Gray and Hayman emerging in control of the race following the pit sequence.
From the race start, pole man Sam Brabham led the field in the run to Turn 1, holding station out front through the right-hander as the field squabbled among itself behind him.
Ryder Quinn fell in behind Flack in the early exchanges, the latter stealing the race lead out of MG on the opening lap.
It left the order Flack from Brabham, Quinn, and Miedecke at the end of the first lap, though it was side-by-side for third, Miedecke gaining the upperhand into Turn 1.
Flack quickly opened up a handy 1.5s buffer over Brabham, who had a queue of cars form behind him that ran back to Astuti in seventh.
The Mercedes was a cork in the bottle as the gaggle behind ebbed and flowed as they scrapped amongst themselves.
Miedecke finally found a way through into second with 24 minutes of the shortened race remaining (reduced owing to a crash in the GT World Challenge race earlier), by which time Flack had skipped away to a 3.4s advantage.
Brabham fell victim to Quinn for third soon after as the BMW moved up the inside into Turn 1.
With 21 minutes remaining, the pit sequence began.
Flack boxed almost immediately to hand the McLaren over to Hayman.
Others were also into the lane, leaving Quinn leading from Nathan Morcom and Brabham, the Mercedes having drifted backwards in the latter stages of the opening stint.
Miedecke had also pitted, handing the car to Gray and feeding out into a temporarily jumbled field.
Heading into the lane, Antonio Astuti clattered into the back of Lachlan Mineeff as they entered the pit lane.
Astuti appeared to misjudge the entry lane, clouting the #1 car ahead to leave both cars with race-ending damage.
Astuti was left stranded at pit entry while Mineeff stopped in the pit lane, where he was pushed clear by his mechanics.
There was no response from race control despite debris littering pit entry as cars poured in to serve their mandatory stop.
That saw Brabham take to the grass to avoid driving through the pieces of his team-mate’s car.
Following the stops, Hayman led in the #25 McLaren previously driven by Flack.
Then came Gray in the Ford Mustang, 1.2s back; the leading two comfortably clear of Jesse Bryan in third, 12s away from the front of the race.
The gap between the two was gradually eroded and, with eight minutes to run, Gray was harrying the back of the leading McLaren.
Hayman resisted initially but was eventually powerless as the Mustang powered by on approach to Turn 4.
While initially that saw Gray skip away, traffic allowed Hayman to close back in with four minutes to run.
Clearly better through the corners, and under brakes in the McLaren, Hayman was just about staying in touch.
The straight-line speed of the Ford was telling, however, as once the traffic was dealt with it was able to inch clear once more.
Gray held on out front to take the chequered flag by 0.7s over Hayman in the McLaren, while Tim Leahey came home as the leading Am class runner in third overall.
The second Monochrome GT4 Australia race of the weekend begins at 10:15 AEST on Sunday morning.